﻿using System;

namespace enyo
{
    /// <summary>
    /// This is used to manage row selection state for lists.
    /// </summary>
    public class Selection : Component
    {
        /// <summary>
        /// if true, allow multiple selections
        /// </summary>
        public bool Multi{get;set;}
    
        /// <summary>
        /// Fires when an item is selected.
        /// </summary>
        public EnyoEvent<Control, object, object> onSelect;
        /*TODO: prototype
         selectRow(inSender, inKey, inPrivateData) 
inKey is whatever key was used to register the selection, usually a row index.
inPrivateData references data registered with this key by the code that made the selection.
         */


        /// <summary>
        /// Fires when an items is deselected.
        /// </summary>
        public EnyoEvent<Control, object, object> onDeselect;
        /*TODO: prototype
deselectRow(inSender, inKey, inPrivateData)    
inKey is whatever key was used to request the deselection, usually a row index.
inPrivateData references data registered with this key by the code that made the original selection.
         */

        /// <summary>
        /// Sent when selection changes (but not when the selection is cleared).
        /// </summary>
        public EnyoEvent<Control> onChange;


        /// <summary>
        /// remove all selections
        /// </summary>
        public void Clear()
        {
        }

        /// <summary>
        /// deselect a row
        /// </summary>
        /// <param name="key"></param>
        public void Deselect(object key)
        {
        }

        /// <summary>
        /// returns true if the inKey row is selected
        /// </summary>
        /// <param name="?"></param>
        /// <returns></returns>
        public bool IsSelected(object key)
        {
            return false;
        }

        /// <summary>
        /// select a row. If the selection has the multi property set to false, it will also deselect the previous selection.
        /// </summary>
        /// <param name="key"></param>
        /// <param name="data"></param>
        public void Select(object key, object data)
        {
        }

        /// <summary>
        /// manually set a row to selected or unselected
        /// </summary>
        /// <param name="key"></param>
        /// <param name="selected"></param>
        /// <param name="data"></param>
        public void SetByKey(object key, bool selected, object data)
        {
        }

        /// <summary>
        /// toggle selection for a row. If the multi is false, toggling a selection on will deselect the previous selection
        /// </summary>
        /// <param name="key"></param>
        /// <param name="data"></param>
        public void Toggle(object key, object data)
        {
        }
    }
}
